home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 5140 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.5 KB

  1. Path: ias_ppp0133.iamerica.net!72274.264
  2. From: 72274.264@compuserve.com (Sergey Kurtsev)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: .EXE/.COM Format....
  5. Date: Fri, 2 Feb 1996 12:49:37 -0500
  6. Organization: Hello, all.
  7. Message-ID: <72274.264.69.0014A387@compuserve.com>
  8. References: <31118F14.2818@iconn.net>
  9. NNTP-Posting-Host: ias_ppp0133.iamerica.net
  10. X-Newsreader: Trumpet for Windows [Version 1.0 Rev B]
  11.  
  12. In article <31118F14.2818@iconn.net> Karl J Poglitsch Jr <kjpoglit@iconn.net> writes:
  13.  
  14. From HelpPC
  15.  
  16. DOS EXE
  17.  
  18.   Offset Size            Description
  19.  
  20.     00   word  "MZ" - Link file .EXE signature (Mark Zbikowski?)
  21.     02   word  length of image mod 512
  22.     04   word  size of file in 512 byte pages
  23.     06   word  number of relocation items following header
  24.     08   word  size of header in 16 byte paragraphs, used to locate
  25.                  the beginning of the load module
  26.     0A   word  min # of paragraphs needed to run program
  27.     0C   word  max # of paragraphs the program would like
  28.     0E   word  offset in load module of stack segment (in paras)
  29.     10   word  initial SP value to be loaded
  30.     12   word  negative checksum of pgm used while by EXEC loads pgm
  31.     14   word  program entry point, (initial IP value)
  32.     16   word  offset in load module of the code segment (in paras)
  33.     18   word  offset in .EXE file of first relocation item
  34.     1A   word  overlay number (0 for root program)
  35.  
  36.     - relocation table and the program load module follow the header
  37.     - relocation entries are 32 bit values representing the offset
  38.       into the load module needing patched
  39.     - once the relocatable item is found, the CS register is added to
  40.       the value found at the calculated offset
  41.  
  42.     Registers at load time of the EXE file are as follows:
  43.  
  44.     AX:     contains number of characters in command tail, or 0
  45.     BX:CX   32 bit value indicating the load module memory size
  46.     DX      zero
  47.     SS:SP   set to stack segment if defined else,  SS = CS and
  48.             SP=FFFFh or top of memory.
  49.     DS      set to segment address of EXE header
  50.     ES      set to segment address of EXE header
  51.     CS:IP   far address of program entry point, (label on "END"
  52.             statement of program)
  53.  
  54. DOS COM is just code w/o any format - loaded and executed as is.
  55.  
  56.   With all my wishes,
  57.   Sergey.
  58.  
  59.   72274.264@compuserve.com                                
  60.   http://ourworld.compuserve.com/homepages/Sergey_Kurtsev 
  61.  
  62. ---
  63.   Pessimist:  Can't be worse :-(
  64.   Optimist :  Can be... Can be... :-]
  65.  
  66.                                    ( A joke :-)
  67.